package com.ogawa.a7517.widget;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

import com.ogawa.a7517.R;

public class NetConfigStateDialog extends Dialog {
    private ImageView ivState;// 提示图标
    private TextView tvTipOne;// 提示语1
    private TextView tvTipTwo;// 提示语2
    private TextView tvConfirm;

    public NetConfigStateDialog(Context context) {
        super(context);
        getWindow().addFlags(Window.FEATURE_NO_TITLE);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        setContentView(R.layout.dialog_net_config_state);
        ivState = findViewById(R.id.iv_state);
        tvTipOne = findViewById(R.id.tv_state_tip_one);
        tvTipTwo = findViewById(R.id.tv_state_tip_two);
        tvConfirm = findViewById(R.id.tv_dialog_confirm);
    }

    /**
     * 设置提示图标
     *
     * @param resId 图标资源id
     */
    public void setTipImg(int resId) {
        ivState.setBackgroundResource(resId);
    }

    /**
     * 设置提示语1
     *
     * @param text 提示语1
     */
    public void setTipOne(String text) {
        tvTipOne.setText(text);
    }

    /**
     * 设置提示语2
     *
     * @param text 提示语2
     */
    public void setTipTwo(String text) {
        tvTipTwo.setText(text);
    }

    public void setOnConfirmClickListener(View.OnClickListener clickListener) {
        tvConfirm.setOnClickListener(clickListener);
    }
}
